<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>一台电脑多个公钥 | 鸿基-梦</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
    <meta name="keywords" content="HJM100,HJM100's Blog" />
  
  <meta name="description" content="windows同一台电脑设置多个公钥与不同github帐号交互 一、生成公钥  安装git，在桌面右键打开 “Git Bash”  键入命令：ssh-keygen -t rsa -C “hjm100@126.com”  提醒你输入key的名称，输入如id_rsa_hjm100;(key的名字为生成公钥或者私钥的文件名)  输入密码，与再次输入密码（这个密码用在你git push或git pull中">
<meta name="keywords" content="web开发技术">
<meta property="og:type" content="article">
<meta property="og:title" content="一台电脑多个公钥">
<meta property="og:url" content="//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/index.html">
<meta property="og:site_name" content="鸿基-梦">
<meta property="og:description" content="windows同一台电脑设置多个公钥与不同github帐号交互 一、生成公钥  安装git，在桌面右键打开 “Git Bash”  键入命令：ssh-keygen -t rsa -C “hjm100@126.com”  提醒你输入key的名称，输入如id_rsa_hjm100;(key的名字为生成公钥或者私钥的文件名)  输入密码，与再次输入密码（这个密码用在你git push或git pull中">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2017-10-12T08:04:07.231Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="一台电脑多个公钥">
<meta name="twitter:description" content="windows同一台电脑设置多个公钥与不同github帐号交互 一、生成公钥  安装git，在桌面右键打开 “Git Bash”  键入命令：ssh-keygen -t rsa -C “hjm100@126.com”  提醒你输入key的名称，输入如id_rsa_hjm100;(key的名字为生成公钥或者私钥的文件名)  输入密码，与再次输入密码（这个密码用在你git push或git pull中">
  
  
    <link rel="icon" href="favicon.ico">
  
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/Blogs/css/style.css">
  <script src="/Blogs/js/pace.min.js"></script>
  

  
  

</head>

<body>
  <div id="container">
      <header id="header">
    <div id="banner"></div>
    <div id="header-outer">
        <div id="header-menu" class="header-menu-pos animated">
            <div class="header-menu-container">
                <a href="/Blogs/" class="left">
                    <span class="site-title">HJM100&#39;s Blog</span>
                </a>
                <nav id="header-menu-nav" class="right">
                    
                    <a  href="/Blogs/">
                        <i class="fa fa-home"></i>
                        <span>Home</span>
                    </a>
                    
                    <a  href="https://gitee.com/hjm100">
                        <i class="fa fa-archive"></i>
                        <span>Gitee</span>
                    </a>
                    
                    <a  href="https://hjm100.cn/about/">
                        <i class="fa fa-user"></i>
                        <span>About</span>
                    </a>
                    
                    <a target="_blank" href="//github.com/hjm100">
                        <i class="fa fa-github"></i>
                        <span>Github</span>
                    </a>
                    
                </nav>
                <a class="mobile-header-menu-button">
                    <i class="fa fa-bars"></i>
                </a>
            </div>
        </div>
        <div id="header-row">
            <div id="logo">
                <a href="/Blogs/">
                    <img src="/Blogs/images/logo.jpg" alt="logo">
                </a>
            </div>
            <div class="header-info">
                <div id="header-title">
                    
                    <h2>
                        HJM100&#39;s Blog
                    </h2>
                    
                </div>
                <div id="header-description">
                    
                    <h3>
                        一个专注 WEB 开发的技术博客
                    </h3>
                    
                </div>
            </div>
            <nav class="header-nav">
                <div class="social">
                    
                        <a title="Cloud yards" target="_blank" href="//gitee.com/hjm100">
                            <i class="fa fa-home fa-2x"></i></a>
                    
                        <a title="qq" target="_blank" href="//1254158627qq.com">
                            <i class="fa fa-qq fa-2x"></i></a>
                    
                        <a title="Github" target="_blank" href="//github.com/hjm100">
                            <i class="fa fa-github fa-2x"></i></a>
                    
                        <a title="Weibo" target="_blank" href="//weibo.com/u/5999637305">
                            <i class="fa fa-weibo fa-2x"></i></a>
                    
                </div>
            </nav>
        </div>
    </div>
</header>
      <div class="outer">
        <section id="main" class="body-wrap"><article id="post-一台电脑多个公钥" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="post-title" itemprop="name">
      一台电脑多个公钥
    </h1>
    <div class="post-title-bar">
      <ul>
          
              <li>
                  <i class="fa fa-book"></i>
                  
                      <a href="/Blogs/categories/开发/">开发</a>
                  
              </li>
          
        <li>
          <i class="fa fa-calendar"></i>  2017-09-27
        </li>
        <li>
          <i class="fa fa-eye"></i>
          <span id="busuanzi_value_page_pv"></span>
        </li>
      </ul>
    </div>
  

          
      </header>
    
    <div class="article-entry post-content" itemprop="articleBody">
      
            
            <p>windows同一台电脑设置多个公钥与不同github帐号交互</p>
<p>一、生成公钥</p>
<ol>
<li><p>安装git，在桌面右键打开 “Git Bash”</p>
</li>
<li><p>键入命令：ssh-keygen -t rsa -C “hjm100@126.com”</p>
</li>
<li><p>提醒你输入key的名称，输入如id_rsa_hjm100;(key的名字为生成公钥或者私钥的文件名)</p>
</li>
<li><p>输入密码，与再次输入密码（这个密码用在你git push或git pull中使用）</p>
</li>
<li><p>在桌面下产生两个文件：id_rsa_hjm100和id_rsa_hjm100.pub</p>
</li>
<li><p>将桌面上的两个文件拷贝到C:\Users\admin.ssh里面（你也可以直接在这个.ssh文件夹中打开 “Git Bash”）</p>
</li>
</ol>
<p>二、配置文件config</p>
<ol>
<li><p>在C:\Users\admin.ssh\目录下创建一个config文件（注意不带文件后缀）</p>
</li>
<li><p>复制一下代码到这个config文件中</p>
<p>（id_rsa指向公钥的名字–最上面的可以理解为一级公钥，比如博客的提交会调用原始的公钥）</p>
</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"><span class="comment">#personal account</span></div><div class="line">Host github.com</div><div class="line">HostName github.com</div><div class="line">User git</div><div class="line">IdentityFile ~/.ssh/id_rsa</div><div class="line"></div><div class="line"><span class="comment">#work account</span></div><div class="line">Host github.com-work</div><div class="line">HostName github.com</div><div class="line">User git</div><div class="line">IdentityFile ~/.ssh/id_rsa_hjm</div></pre></td></tr></table></figure>
<p>三、添加公钥到某个github账号</p>
<p>1.登录自己的账号到github.com的网站上</p>
<p>2.点击头像后点击生成下拉框中的Settings</p>
<p>3.在设置页面点击SSH and GPG keys进入公钥管理页面</p>
<p>4.点击New SSH key 在Title中填写名字（随意的标识）</p>
<p>5.用记事本打开id_rsa.pub文件，复制内容，粘贴到Key输入框中保存即可</p>

            <div class="post-copyright">
    <div class="content">
        <p>最后更新： 2017年10月12日 16:04</p>
        <p>原始链接： <a class="post-url" href="/Blogs/2017/09/27/一台电脑多个公钥/" title="一台电脑多个公钥">//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/</a></p>
        <footer>
            <a href="//hjm100.cn/about">
                <img src="/Blogs/images/logo.jpg" alt="hjm100">
                hjm100
            </a>
        </footer>
    </div>
</div>

      
    </div>
    <footer class="article-footer">
        
        
<div class="post-share">
    <a href="javascript:;" id="share-sub" class="post-share-fab">
        <i class="fa fa-share-alt"></i>
    </a>
    <div class="post-share-list" id="share-list">
        <ul class="share-icons">
          <li>
            <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/&title=《一台电脑多个公钥》 — 鸿基-梦&pic=//hjm100.cn/Blogsimages/logo.jpg" data-title="微博">
              <i class="fa fa-weibo"></i>
            </a>
          </li>
          <li>
            <a class="weixin share-sns" id="wxFab" href="javascript:;" data-title="微信">
              <i class="fa fa-weixin"></i>
            </a>
          </li>
          <li>
            <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/&title=《一台电脑多个公钥》 — 鸿基-梦&source=前端博客,鸿基梦,hjm100," data-title="QQ">
              <i class="fa fa-qq"></i>
            </a>
          </li>
          <li>
            <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/" data-title="Facebook">
              <i class="fa fa-facebook"></i>
            </a>
          </li>
          <li>
            <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《一台电脑多个公钥》 — 鸿基-梦&url=//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/&via=//hjm100.cn/Blogs" data-title="Twitter">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
          <li>
            <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/" data-title="Google+">
              <i class="fa fa-google-plus"></i>
            </a>
          </li>
        </ul>
     </div>
</div>
<div class="post-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;" id="wxShare-close">×</a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=//hjm100.cn/Blogs/2017/09/27/一台电脑多个公钥/" alt="微信分享二维码">
</div>

<div class="mask"></div>

        
        <ul class="article-footer-menu">
            
            
  <li class="article-footer-tags">
    <i class="fa fa-tags"></i>
      
    <a href="/Blogs/tags/web开发技术/" class="color3">web开发技术</a>
      
  </li>

        </ul>
        
    </footer>
  </div>
</article>



<nav id="article-nav">
  
    <a href="/Blogs/2017/09/29/hexo搭建博客/" id="article-nav-newer" class="article-nav-link-wrap">

      <span class="article-nav-title">
        <i class="fa fa-hand-o-left" aria-hidden="true"></i>
        
          hexo搭建博客
        
      </span>
    </a>
  
  
    <a href="/Blogs/2017/08/09/如何做好项目总结/" id="article-nav-older" class="article-nav-link-wrap">
      <span class="article-nav-title">如何做好项目总结</span>
      <i class="fa fa-hand-o-right" aria-hidden="true"></i>
    </a>
  
</nav>



    
        <section id="comments">
            <div id="disqus_thread">
                <script type="text/javascript">
                    var disqus_shortname = 'true';
                    (function() {
                        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
                    })();
                </script>
                <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
            </div>
        </section>
    
</section>
        
      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info" class="inner">
      
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


      <p>&copy; 2017 hjm100
          .版权所有 | 相关设计 <a href="https://gitee.com/hjm100" target="_blank">鸿基梦</a><br>
      </p>
    </div>
  </div>
</footer>
    <script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
  var mihoConfig = {
      root: "//hjm100.cn/Blogs",
      animate: true,
      isHome: false,
      share: true
  }
</script>
<div class="sidebar">
    <div id="sidebar-search" title="Search">
        <i class="fa fa-search"></i>
    </div>
    <div id="sidebar-category" title="Categories">
        <i class="fa fa-book"></i>
    </div>
    <div id="sidebar-tag" title="Tags">
        <i class="fa fa-tags"></i>
    </div>
    <div id="sidebar-top">
        <span class="sidebar-top-icon"><i class="fa fa-angle-up"></i></span>
    </div>
</div>
<div class="sidebar-menu-box" id="sidebar-menu-box">
    <div class="sidebar-menu-box-container">
        <div id="sidebar-menu-box-categories">
            <a class="category-link" href="/Blogs/categories/web/">web</a><a class="category-link" href="/Blogs/categories/习惯/">习惯</a><a class="category-link" href="/Blogs/categories/学习/">学习</a><a class="category-link" href="/Blogs/categories/开发/">开发</a>
        </div>
        <div id="sidebar-menu-box-tags">
            <a href="/Blogs/tags/angular/" style="font-size: 10px;">angular</a> <a href="/Blogs/tags/web开发技术/" style="font-size: 20px;">web开发技术</a> <a href="/Blogs/tags/工作习惯/" style="font-size: 15px;">工作习惯</a> <a href="/Blogs/tags/开发技术/" style="font-size: 10px;">开发技术</a>
        </div>
    </div>
    <a href="javascript:;" class="sidebar-menu-box-close">&times;</a>
</div>
<div class="mobile-header-menu-nav" id="mobile-header-menu-nav">
    <div class="mobile-header-menu-container">
        <span class="title">Menus</span>
        <ul class="mobile-header-menu-navbar">
            
            <li>
                <a  href="/Blogs/">
                    <i class="fa fa-home"></i><span>Home</span>
                </a>
            </li>
            
            <li>
                <a  href="https://gitee.com/hjm100">
                    <i class="fa fa-archive"></i><span>Gitee</span>
                </a>
            </li>
            
            <li>
                <a  href="https://hjm100.cn/about/">
                    <i class="fa fa-user"></i><span>About</span>
                </a>
            </li>
            
            <li>
                <a target="_blank" href="//github.com/hjm100">
                    <i class="fa fa-github"></i><span>Github</span>
                </a>
            </li>
            
        </ul>
    </div>
    <div class="mobile-header-tag-container">
        <span class="title">Tags</span>
        <div id="mobile-header-container-tags">
            <a href="/Blogs/tags/angular/" style="font-size: 10px;">angular</a> <a href="/Blogs/tags/web开发技术/" style="font-size: 20px;">web开发技术</a> <a href="/Blogs/tags/工作习惯/" style="font-size: 15px;">工作习惯</a> <a href="/Blogs/tags/开发技术/" style="font-size: 10px;">开发技术</a>
        </div>
    </div>
</div>
<div class="search-wrap">
    <span class="search-close">&times;</span>
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
            <i class="icon icon-lg icon-chevron-left"></i>
        </a>
        <input class="search-field" placeholder="Search..." id="keywords">
        <a id="search-submit" href="javascript:;">
            <i class="fa fa-search"></i>
        </a>
    <div class="search-container" id="search-container">
        <ul class="search-result" id="search-result">
        </ul>
    </div>
</div>

<div id="search-tpl">
    <li class="search-result-item">
        <a href="{url}" class="search-item-li">
            <span class="search-item-li-title" title="{title}">{title}</span>
        </a>
    </li>
</div>
<script src="/Blogs/js/search.js"></script>
<script src="/Blogs/js/main.js"></script>


  <script src="//cdn.bootcss.com/particles.js/2.0.0/particles.min.js"></script>
  <div id="particles"></div>
  <script src="/Blogs/js/particles.js"></script>







  <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">
  <script src="//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js"></script>
  <script src="/Blogs/js/animate.js"></script>

  </div>
</body>
</html>